package com.wjy.common.config.mybatisplus;

import com.baomidou.mybatisplus.core.injector.ISqlInjector;
import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author ybxxszl
 * @desc MyBatisPlus配置
 * @data 2019年4月12日
 */
@Configuration
public class MyBatisPlusConfig {

    /*
     * 逻辑删除
     */
    @Bean
    public ISqlInjector sqlInjector() {

        LogicSqlInjector logicSqlInjector = new LogicSqlInjector();

        return logicSqlInjector;

    }

    /*
     * 乐观锁
     */
    @Bean
    public OptimisticLockerInterceptor optimisticLockerInterceptor() {

        OptimisticLockerInterceptor optimisticLockerInterceptor = new OptimisticLockerInterceptor();

        return optimisticLockerInterceptor;

    }

}
